#include "stdafx.h"
#include "CareerPropertyPage.h"
#include "Career.h"
#include "Property.h"

#include <utility/Config.h>
#include <utility/Streams.h>

#ifdef WIN32
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#endif

#define CREATE_CAREER(name) this->CreateRadioButton(m##name, Career::##name##Name(), false)
#define LAYOUT_CAREER(name) this->Layout(&m##name, config, _T(#name))
#define GET_CHECK(name) \
	if (m##name.GetCheck())\
	{\
		return Property::NewProperty(0, Career::##name##Id(), 0, 0, Career::##name##Name(), mTmpl);\
	}


namespace serika
{
	namespace dq
	{
		CareerPropertyPage::CareerPropertyPage(PropertyTemplate* tmpl)
			: PropertyPage(tmpl)
		{
		}

		CareerPropertyPage::~CareerPropertyPage()
		{
		}

		void CareerPropertyPage::OnInitialize()
		{
			CREATE_CAREER(Warrior);
			CREATE_CAREER(Priest);
			CREATE_CAREER(Mage);
			CREATE_CAREER(Fighter);
			CREATE_CAREER(Robber);
			CREATE_CAREER(Artist);
			CREATE_CAREER(BattleMaster);
			CREATE_CAREER(Paladin);
			CREATE_CAREER(MageWarrior);
			CREATE_CAREER(Ranger);
			CREATE_CAREER(Philosopher);
			CREATE_CAREER(Superstar);
		}

		void CareerPropertyPage::DoLayout(ut::Config* config)
		{
			LAYOUT_CAREER(Warrior);
			LAYOUT_CAREER(Priest);
			LAYOUT_CAREER(Mage);
			LAYOUT_CAREER(Fighter);
			LAYOUT_CAREER(Robber);
			LAYOUT_CAREER(Artist);
			LAYOUT_CAREER(BattleMaster);
			LAYOUT_CAREER(Paladin);
			LAYOUT_CAREER(MageWarrior);
			LAYOUT_CAREER(Ranger);
			LAYOUT_CAREER(Philosopher);
			LAYOUT_CAREER(Superstar);
		}

		Property* CareerPropertyPage::CreateProperty()
		{
			GET_CHECK(Warrior);
			GET_CHECK(Priest);
			GET_CHECK(Mage);
			GET_CHECK(Fighter);
			GET_CHECK(Robber);
			GET_CHECK(Artist);
			GET_CHECK(BattleMaster);
			GET_CHECK(Paladin);
			GET_CHECK(MageWarrior);
			GET_CHECK(Ranger);
			GET_CHECK(Philosopher);
			GET_CHECK(Superstar);
			return 0;
		}

		void CareerPropertyPage::OnActivate()
		{
		}

		void CareerPropertyPage::OnDeactivate()
		{
		}
	}
}
